unit Alta_Estado_Empleados;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DBCtrls, DB;

type
  TF_AltaEstadoEmpleados = class(TForm)
    B_Cancel: TButton;
    B_Accept: TButton;
    DataSource1: TDataSource;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    GroupBox1: TGroupBox;
    procedure B_AcceptClick(Sender: TObject);
    procedure B_CancelClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_AltaEstadoEmpleados: TF_AltaEstadoEmpleados;

implementation

{$R *.dfm}

procedure TF_AltaEstadoEmpleados.B_AcceptClick(Sender: TObject);
begin
  if (TRIM(DBEdit1.Text) = '') THEN
    ShowMessage('Debe completar todos los datos requeridos.')
  ELSE
  BEGIN
    DataSource1.DataSet.Append;
    DataSource1.DataSet.Refresh;
    SELF.Close;
  END;
end;

procedure TF_AltaEstadoEmpleados.B_CancelClick(Sender: TObject);
begin
    DataSource1.DataSet.Cancel;
    SELF.Close;
    DataSource1.DataSet.First;
end;

procedure TF_AltaEstadoEmpleados.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
    DataSource1.DataSet.Cancel;
end;

end.
